﻿using System;
using RestSharp;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace yinyue
{
    class HttpTool
    {
        private static HttpTool instance = null;
        private HttpTool() { }  
        public static HttpTool getInstance()
        {
            if (instance == null)
            {
                instance = new HttpTool();
            }
            return instance;
        }
        public Songlist[] getHttp(String a)
        {
            var client = new RestClient(" http://route.showapi.com/213-4");
            var request = new RestRequest(Method.GET);
            request.AddParameter("topid", a);
            request.AddParameter("showapi_appid", "38643");
            request.AddParameter("showapi_sign", "f7258039023c40cfb4cfdb2870502d91");
            var o = new Rootobject();
            o = JsonConvert.DeserializeObject<Rootobject>(client.Execute(request).Content);
            var songlist = o.showapi_res_body.pagebean.songlist;
            return songlist;
        }
    }
}
